package com.icedata.sika.core

/**
 * 指令处理器
 */
class CommandProcessor(
    function: suspend (Command, Sika) -> Result,
    priority: Int = 5000,
    /**
     * 指令过滤器
     */
    var filter: (Command) -> Boolean = { _ -> false }
) : AbstractAsyncProcessor<Command, CommandProcessor.Result>(function, priority) {


    constructor(
        function: suspend (Command) -> Result,
        priority: Int = 5000,
        filter: (Command) -> Boolean = { _ -> false }
    ) : this(
        { command, _ -> function(command) }, priority, filter
    )

    override fun onMount(sika: Sika) {
//        TODO("Not yet implemented")
    }

    override fun onUnmount(sika: Sika) {
//        TODO("Not yet implemented")
    }

    enum class Result {
        ADOPT, BLOCK,
    }
}